package com.example.bbs.agent.lazy;

import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.example.bbs.dao.BaseDao;

import javax.sql.DataSource;
import java.util.Properties;

/**
 * author: VC
 * create: 2021/7/16 10:08
 * version: 1.0.0
 */
public class Main {
    public static void main(String[] args) {
        Properties prop = new Properties();
        try {
            //读文件
            prop.load(Main.class.getResourceAsStream("/druid.properties"));
            //创建数据源
            DataSource source = DruidDataSourceFactory.createDataSource(prop);
            BaseDao.init(source);
        } catch (Exception e) {
            e.printStackTrace();
        }


//       Post post = new PostDaoImpl().findById(7);
//
//        System.out.println(post.getTitle());
//        System.out.println(post.getUser().getUid());
//        System.out.println("-----------------");
//        System.out.println(post.getUser().getName());
    }
}
